/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - resource
// Copyright( c) 2014.  All Rights Reserved
//
// File:		AEResource.cpp
// Author:		Gianluca Belardelli
// Date:		29/09/2014
//
/////////////////////////////////////////////////////////////////////////
#include <AEEngine.h>

AEFLOAT32 AEResource::m_fGlobalTime = 0.0f;

AEResource::AEResource( AEResourceManager *lpParentManager ) : m_lpFilename( 0L ),
	m_uiUniqueSysMemSize(0),
	m_uiUniqueGPUMemSize(0),
	m_uiDependentSysMemSize(0),
	m_uiDependentGPUMemSize(0),
	m_fLastTimeUsed(0.0f),
	m_uiLockCounter(0),
	m_uiResourceFlags(0),
	m_lpParentManager( lpParentManager )
{
}
	
AEResource::~AEResource( void )
{

}

void AEResource::SetFilename( const char *lpFilename )
{
	if( m_lpFilename != 0L )
		AEMemoryManager::GetInstancePtr()->GetHeapAllocator().BlockFree( m_lpFilename, strlen( m_lpFilename ) );

	m_lpFilename = (char *)AEMemoryManager::GetInstancePtr()->GetHeapAllocator().BlockAlloc( strlen( lpFilename ) + 1 );
	strcpy( m_lpFilename, lpFilename );
}

void AEResource::DoReload( void )
{
	m_lpParentManager->LoadResource( m_lpFilename );
}

void AEResource::DoUnload( void )
{
}

void AEResource::OnEnterBackground( void )
{
}

void AEResource::OnLeaveBackground( void )
{
}
